import SysRoleModel from "../../../model/system/SysRoleModel";
import SysMenuModel from "../../../model/system/SysMenuModel";

SysRoleModel.belongsToMany(SysMenuModel, {
  as: "menu", // 目标别名
  through: "sys_role_menu", // 关联表名称
  foreignKey: "roleId", // 当前模型在关联表中的外键
  otherKey: "menuId", // 对方模型在关联表中的外键
  timestamps: false,
});

SysMenuModel.belongsToMany(SysRoleModel, {
  as: "role",
  through: "sys_role_menu",
  foreignKey: "menuId",
  otherKey: "roleId",
  timestamps: false,
});
